<template lang="pug">
  .zgplugin-videoupload.zgplugin-empty(v-if="(!exist || !show)&&editor")
    svg-icon.empty-icon(icon-class="组件音频上传")
  el-form-item.zgplugin-videoupload(v-show="show" v-else-if="exist" :class="config.label?'':'form-label-hidden'" :label="config.label" :prop="config.propertyName" :rules="rules")
    div.upload-border
      el-upload(:show-file-list='false' :is-mobile='isMobile' accept="audio/mp3" class="upload-demo" :disabled="readonly" :on-remove='handleRemove' :on-change="handleChange" action=""
      multiple :file-list="rootForm.properties[config.propertyName]" :http-request="uploadFile")
        el-button(:disabled="readonly" size="small" type="primary" style="margin-left:4px;padding:9px 10px")
          | 选择音频
          i(class="el-icon-upload el-icon--right")
        span.picture-name(v-if="rootForm.properties[config.propertyName]") 上传成功
</template>

<script>
import renderCommon from '../common/renderCommon'

export default {
  mixins: [renderCommon],
}
</script>
<style lang="scss">
.zgplugin-videoupload {
  margin-top: 16px;
  margin-bottom: 0 !important;
  .upload-border {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    .vedio-box {
      position: relative;
      width: 320px;
      height: 240px;
      margin: 0 4px;
      display: inline-block;
      &:hover {
        .icon-modal {
          display: block;
        }
      }
      .icon-modal {
        width: 80px;
        height: 50px;
        line-height: 50px;
        text-align: center;
        color: rgba(255, 255, 255, 0.8);
        font-size: 22px;
        position: absolute;
        top: 0;
        left: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 2;
        display: none;
        .icon {
          margin: 0 4px;
          cursor: pointer !important;
        }
      }
      .vedio-upload {
        width: 100%;
        height: 100%;
        border: none;
        display: block;
      }
    }
  }
}
</style>
